package com.jeesite.modules.warehousearea.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 库区档案Entity
 * @author 码脑洞
 * @version 2025-04-08
 */
@Table(name="t_warehouse_area", alias="a", label="库区档案信息", columns={
		@Column(name="auto_id", attrName="autoId", label="主键", isPK=true),
		@Column(name="org_id", attrName="orgId", label="组织ID", isQuery=false),
		@Column(name="org_code", attrName="orgCode", label="组织编码", isQuery=false),
		@Column(name="org_name", attrName="orgName", label="组织名称", isQuery=false),
		@Column(name="code", attrName="code", label="库区编码"),
		@Column(name="name", attrName="name", label="库区名称", queryType=QueryType.LIKE),
		@Column(name="warehouse_id", attrName="warehouseId", label="所属仓库"),
		@Column(name="source_type", attrName="sourceType", label="来源", comment="来源: 1.手工新增 2. ERP", isQuery=false),
		@Column(name="source_code", attrName="sourceCode", label="来源编码", isQuery=false),
		@Column(includeEntity=DataEntity.class),
	}, orderBy="a.update_date DESC"
)
public class WarehouseArea extends DataEntity<WarehouseArea> {
	
	private static final long serialVersionUID = 1L;
	private Long autoId;		// 主键
	private Long orgId;		// 组织ID
	private String orgCode;		// 组织编码
	private String orgName;		// 组织名称
	private String code;		// 库区编码
	private String name;		// 库区名称
	private Long warehouseId;		// 所属仓库
	private String sourceType;		// 来源: 1.手工新增 2. ERP
	private String sourceCode;		// 来源编码

	public WarehouseArea() {
		this(null);
	}
	
	public WarehouseArea(String id){
		super(id);
	}
	
	@JsonSerialize(using = ToStringSerializer.class)
	public Long getAutoId() {
		return autoId;
	}

	public void setAutoId(Long autoId) {
		this.autoId = autoId;
	}
	
	@NotNull(message="组织ID不能为空")
	public Long getOrgId() {
		return orgId;
	}

	public void setOrgId(Long orgId) {
		this.orgId = orgId;
	}
	
	@NotBlank(message="组织编码不能为空")
	@Size(min=0, max=10, message="组织编码长度不能超过 10 个字符")
	public String getOrgCode() {
		return orgCode;
	}

	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}
	
	@NotBlank(message="组织名称不能为空")
	@Size(min=0, max=30, message="组织名称长度不能超过 30 个字符")
	public String getOrgName() {
		return orgName;
	}

	public void setOrgName(String orgName) {
		this.orgName = orgName;
	}
	
	@NotBlank(message="库区编码不能为空")
	@Size(min=0, max=30, message="库区编码长度不能超过 30 个字符")
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}
	
	@NotBlank(message="库区名称不能为空")
	@Size(min=0, max=100, message="库区名称长度不能超过 100 个字符")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	@NotNull(message="所属仓库不能为空")
	@JsonSerialize(using = ToStringSerializer.class)
	public Long getWarehouseId() {
		return warehouseId;
	}

	public void setWarehouseId(Long warehouseId) {
		this.warehouseId = warehouseId;
	}
	
	@Size(min=0, max=1, message="来源长度不能超过 1 个字符")
	public String getSourceType() {
		return sourceType;
	}

	public void setSourceType(String sourceType) {
		this.sourceType = sourceType;
	}
	
	@Size(min=0, max=64, message="来源编码长度不能超过 64 个字符")
	public String getSourceCode() {
		return sourceCode;
	}

	public void setSourceCode(String sourceCode) {
		this.sourceCode = sourceCode;
	}
	
}